package cn.crm.bean;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.SEQUENCE;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "US_USER")
public class User implements java.io.Serializable {

	// Fields

	private Integer usCid;
	private DDL DDLByTypeDepartments;
	private DDL DDLByTypeDuties;
	private String usEmpid;
	private String usEmpname;
	private String usPass;
	private Boolean usIsdlete;

	// Constructors

	/** default constructor */
	public User() {
	}

	/** full constructor */
	public User(DDL DDLByTypeDepartments, DDL DDLByTypeDuties, String usEmpid,
			String usEmpname,String usPass, Boolean usIsdlete, Set<AddressBook> addressBooks,
			Set<CustService> custServices,
			Set<WorkPlan> workPlansForUsResponsible,
			Set<WorkPlan> workPlansForUsSuperintendent,
			Set<InOutLog> inOutLogs, Set<Appointement> appointements) {
		this.DDLByTypeDepartments = DDLByTypeDepartments;
		this.DDLByTypeDuties = DDLByTypeDuties;
		this.usEmpid = usEmpid;
		this.usEmpname = usEmpname;
		this.usPass=usPass;
		this.usIsdlete = usIsdlete;
	}

	// Property accessors
	@SequenceGenerator(name = "generator",sequenceName="seq_cust_user_id")
	@Id
	@GeneratedValue(strategy = SEQUENCE, generator = "generator")
	@Column(name = "US_CID", unique = true, nullable = false, precision = 6, scale = 0)
	public Integer getUsCid() {
		return this.usCid;
	}

	public void setUsCid(Integer usCid) {
		this.usCid = usCid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TYPE_DEPARTMENTS")
	public DDL getDDLByTypeDepartments() {
		return this.DDLByTypeDepartments;
	}

	public void setDDLByTypeDepartments(DDL DDLByTypeDepartments) {
		this.DDLByTypeDepartments = DDLByTypeDepartments;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TYPE_DUTIES")
	public DDL getDDLByTypeDuties() {
		return this.DDLByTypeDuties;
	}

	public void setDDLByTypeDuties(DDL DDLByTypeDuties) {
		this.DDLByTypeDuties = DDLByTypeDuties;
	}

	@Column(name = "US_EMPID", length = 15)
	public String getUsEmpid() {
		return this.usEmpid;
	}

	public void setUsEmpid(String usEmpid) {
		this.usEmpid = usEmpid;
	}

	@Column(name = "US_EMPNAME", length = 8)
	public String getUsEmpname() {
		return this.usEmpname;
	}

	public void setUsEmpname(String usEmpname) {
		this.usEmpname = usEmpname;
	}
	
	@Column(name = "us_pass", length = 32)
	public String getUsPass() {
		return usPass;
	}

	public void setUsPass(String usPass) {
		this.usPass = usPass;
	}

	@Column(name = "US_ISDLETE", precision = 1, scale = 0)
	public Boolean getUsIsdlete() {
		return this.usIsdlete;
	}

	public void setUsIsdlete(Boolean usIsdlete) {
		this.usIsdlete = usIsdlete;
	}
	
}